<?php
// application/forms/Article.php

/**
 * This is the guestbook form.  It is in its own directory in the application 
 * structure because it represents a "composite asset" in your application.  By 
 * "composite", it is meant that the form encompasses several aspects of the 
 * application: it handles part of the display logic (view), it also handles 
 * validation and filtering (controller and model).  
 */
class Form_Search extends Zend_Form
{

    protected $_noDecorator = array(
        'ViewHelper', 
        'Errors'
    );
    public function cluBuild($params)
    {
        // set the method for the display form to POST
//        $this->setAttrib('id', 'new_article');
        $this->setMethod('POST');
//        $a = $params['view']->hvnUrl(array('module' => 'article', 'action'=>'search', 'view' => $this->view));
//        $this->setAction($a);
		$intValidator = new Zend_Validate_Int();

		$this->setAction($params['action_url']);
		
        //status
        $status = new Zend_Form_Element_Select('status',  
                         array('disableLoadDefaultDecorators' => true,
                                'required' => true)); 
        $status->addMultiOption('all','--'.t(61).'--')
        	   ->addMultiOption('published',t(34))
        	   ->addMultiOption('featured',t(33))
               ->addMultiOption('queued',t(35))
               ->addMultiOption('unpublished',t(36))
               ->addMultiOption('deleted',t(37))
               ->addDecorators($this->_noDecorator);

        $this->addElement($status);
        
        //module
        $modules = new Zend_Form_Element_Select('modules',  
                         array('disableLoadDefaultDecorators' => true,
                                'required' => true));
        $modules->addMultiOption('all','--'.t(61).'--')
               ->addMultiOption('blog',t(98))
               ->addMultiOption('forum',t(99))
               ->addMultiOption('tour',t(801))
               ->addMultiOption('place',t(701))
               ->addMultiOption('event',t(201))
               ->addMultiOption('blast','blast')
               ->addMultiOption('news','news')
               ->addMultiOption('gallery','gallery')
               ->addMultiOption('promotion','promotion')
               ->addMultiOption('other',t(100))
               
               ->addDecorators($this->_noDecorator);
		
        $this->addElement($modules);
        
        //articles per page
 		$articles_per_page = new Zend_Form_Element_Select('articles_per_page',  
                         array('disableLoadDefaultDecorators' => true));
        $articles_per_page->addMultiOption(10,t(62))
               				->addMultiOption(20,t(63))
                           	->addMultiOption(30,t(64))
                           	->addMultiOption(40,t(65))
                           	->addMultiOption(50,t(66))
                           	->addDecorators($this->_noDecorator);
        $this->addElement($articles_per_page);
        
 		// choose type to search
 		$languageOperator = new Zend_Form_Element_Select('languageOperator',  
                         array('disableLoadDefaultDecorators' => true,
                                'required' => true));
        $languageOperator->addMultiOption('none',t(104))
               ->addMultiOption('origin',t(105))
               ->addMultiOption('been_translated',t(106))
               ->addMultiOption('not_translated',t(107))
               ->addDecorators($this->_noDecorator);
        $this->addElement($languageOperator);
        
        //language
 		$language = new Zend_Form_Element_Select('language',  
                         array('disableLoadDefaultDecorators' => true,
                                'required' => true)); 
        $language->addMultiOption('all','--'.t(61).'--')
        		   ->addMultiOption('vi',t(40))
                   ->addMultiOption('en',t(41))
                   ->addMultiOption('cn',t(42))
                   ->addMultiOption('jp',t(43))
                   ->addDecorators($this->_noDecorator);
        $this->addElement($language);
        
		//translator id
        $translatorId = new Zend_Form_Element_Text('translator_id', 
                         array('disableLoadDefaultDecorators' => true));
                               //'class' => 'inputText'));
				                  
		$translatorId->addValidator($intValidator)
				 ->addDecorators($this->_noDecorator);
		$this->addElement($translatorId);
        
        //poster_id
        $posterId = new Zend_Form_Element_Text('poster_id', 
                         array('disableLoadDefaultDecorators' => true));
                               //'class' => 'inputText'));
		$posterId->addValidator($intValidator)
				 ->addDecorators($this->_noDecorator);
		$this->addElement($posterId);

		//post time
 		$post_timeOperator = new Zend_Form_Element_Select('post_timeOperator',  
                         array('disableLoadDefaultDecorators' => true));
        $post_timeOperator->addMultiOption('1',t(101))
               ->addMultiOption('2',t(102))
               ->addMultiOption('3',t(103))
               ->addMultiOption('4',t(61))
               ->addDecorators($this->_noDecorator);
               
        $this->addElement($post_timeOperator);
		

		//update time
 		$update_timeOperator = new Zend_Form_Element_Select('update_timeOperator',  
                         array('disableLoadDefaultDecorators' => true));
        $update_timeOperator->addMultiOption('0',t(104))
               ->addMultiOption('1',t(101))
               ->addMultiOption('2',t(102))
               ->addMultiOption('3',t(103))
               ->addMultiOption('4',t(61))
               ->addDecorators($this->_noDecorator);
        $this->addElement($update_timeOperator);
        
        //article originality
        $article_originality = new Zend_Form_Element_Select('article_originality',  
                         array('disableLoadDefaultDecorators' => true,
                                'required' => true)); 
        $article_originality->addMultiOption('all', t(61))
        					->addMultiOption('copy',t(524))
                 			->addMultiOption('original',t(525))
                 			->addMultiOption('collection',t(527))
                 			->addDecorators($this->_noDecorator);
        $this->addElement($article_originality);
        
        // add the submit button

        $submit = new Zend_Form_Element_Submit('submit', array('disableLoadDefaultDecorators' => true, 
                                                               'label' => t(67) ));
        $submit->addDecorators($this->_noDecorator);
        $this->addElement($submit);
    }
}
?>